package multimedia;

import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import multimedia.Placer;

public class MultimediaList extends Placer {

	static final int X_FOCUS=100;
	static final int Y_FOCUS=100;
	static final int DY=40;
	static final int DX=20;
	private List<String> multimedia=new ArrayList<String>();
    private MultimediaListListener listener;
	private int index;
	private Placer placer= new Placer();
	
	
	public MultimediaList(Collection<String> multimedia){
		this.multimedia.addAll(multimedia);
		
		
	}
    public void setPanel(MultimediaListListener panel){
    	this.listener=panel;
    }
    
    public void draw(Graphics graphics){
    	
    	for (int i = 0; i < multimedia.size(); i++) {
			String data=multimedia.get(i);
			
			int slot= i-index;
			if (slot==0) {
				graphics.setColor(Color.RED);
			}else{
				graphics.setColor(Color.BLACK);
			}
			placer.place(graphics,data,slot);
			
			
			
    	}
    	
    	
	}
	public void setVertical(){
    	placer.setVertical();
    	listener.update(this);
    }
    public void setDiagonal(){
    	placer.setDiagonal();
    	listener.update(this);
    }
    public void up(){
    	if (index<multimedia.size()-1) {
    		index++;
    	}
    	listener.update(this);
    }
    
    public void down(){
    	if (index>0) {
    		index--;
    	}
    	listener.update(this);
    }


}
